SANDBOX_DIR := ../../sandboxes/llm_local

.PHONY: help setup attack stop

# Default target
help:
	@echo "Red Team Example - Available Commands:"
	@echo ""
	@echo "  make setup    - Build and start the local LLM sandbox"
	@echo "  make attack   - Run the adversarial attack script"
	@echo "  make stop     - Stop and remove the sandbox container"
	@echo "  make all      - Run setup, attack, and stop in sequence"
	@echo "  make format   - Run code formatting (black, isort, mypy)"
	@echo "  make sync     - Sync dependencies with uv"
	@echo "  make lock     - Lock dependencies with uv"
	@echo ""
	@echo "Environment:"
	@echo "  - Sandbox Directory: $(SANDBOX_DIR)"
	@echo ""

sync:
	uv sync

lock:
	uv lock

format:
	uv run black .
	uv run isort .
	uv run mypy .

setup:
	@echo "🚀 Setting up Red Team environment..."
	$(MAKE) -C $(SANDBOX_DIR) run-gradio-headless
	@echo "⏳ Waiting for service to be ready..."
	@sleep 5
	@echo "✅ Environment ready!"

attack: sync lock
	@echo "⚔️  Launching Red Team attack..."
	uv run attack.py

stop:
	@echo "🧹 Tearing down Red Team environment..."
	$(MAKE) -C $(SANDBOX_DIR) stop-gradio
	$(MAKE) -C $(SANDBOX_DIR) down
	@echo "✅ Environment cleaned up!"

all: stop setup attack stop
	@echo "Red Team Example - Completed!"
